package com.yy.springcloud.controller;

import com.yy.springcloud.entity.CommonResult;
import com.yy.springcloud.entity.Payment;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@Slf4j
@RequestMapping("order")
public class OrderController {

//    public static final String URL = "http://localhost:8001";
//    服务地址去eureka中粘贴过来
    public static final String URL = "http://CLOUD-PAYMENT-SERVICE";
    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("get")
    public CommonResult<Payment> get(){
        return restTemplate.getForObject(URL+"/payment/get",CommonResult.class);
    }
}
